﻿using LightCAD.Core;
using LightCAD.Drawing.Actions;
using LightCAD.Runtime;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LightCAD.UI.Axis
{
    public partial class AxisNumberSettingFrom : FormBase, IAxisLineManageFrom
    {
        public AxisNumberSettingFrom()
        {
            InitializeComponent();
        }
        private AxisGridAction axisLineAction;
        public AxisNumberSettingFrom(params object[] args) : this()
        {
            if (args != null && args.Length > 0)
            {
                this.axisLineAction = (AxisGridAction)args[0];
            }
        }

        public string CurrentAction { get; set; }
        public LcAxisGrid lcAxisGrid { get; set; }

        public bool IsActive => true;

        public Type WinType => this.GetType();
        private double GetRadius()
        {
            double redius = 0;
            double.TryParse(tbRadius.Text, out redius);
            return redius;
        }
        public double Radius { get => GetRadius(); set { tbRadius.Text = value.ToString(); } }
        public string FirstAxisNum { get => this.textFirstAxisNum.Text; set { this.textFirstAxisNum.Text = value; } }
        public string OrderingRule { get; set; }
        public int AxisNumType { get => cbLabelDir.SelectedIndex; set => cbLabelDir.SelectedIndex = value; }

        private void AxisNumberSettingFrom_Load(object sender, EventArgs e)
        {
            this.cbLabelDir.Items.Clear();
            this.cbLabelDir.Items.Add("双侧标注");
            this.cbLabelDir.Items.Add("单侧标注");
            this.cbLabelDir.Items.Add("对侧标注");
            this.cbOrderingRule.Items.Clear();
            this.cbOrderingRule.Items.Add("1A 2A 3A");
            this.cbOrderingRule.Items.Add("1A 2B 3C");
        }

        private void btnInsertAxisNum_Click(object sender, EventArgs e)
        {
            this.CurrentAction = "InsertAxisNum";
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
